extends ColorRect

var options:Array
const option = preload('res://scene/option.tscn')

func _ready():
	get_options(options)
	pass

# 对选项进行组合
func get_options(datas:Array):
	# 0 -- 600, len_y is 40
	var y_data = (global.window_h / 2) - 20 - (25 * len(datas) - 1)
	var option_number = 0
	for data in datas:
		get_option(data,y_data,option_number)
		option_number += 1
		y_data += 50
	pass

# 获取单个选项
func get_option(text:String, y:int, option_number:int):
	var the_option = option.instance()
	the_option.text = text
	the_option.option_number = option_number
	the_option.rect_position.y = y
	add_child(the_option)
